/**
 * Created by Administrator on 2017/4/11.
 */
swan_pc
    .controller("OrganizationContactController",function($scope,ContactInfo,Upload,ngDialog,CompanyInfo,OrgContactInfo,$rootScope,tagSetByOrg,Category,$cookieStore,OrgCompanyInfo){
        $cookieStore.put('_currentOrganizationId',$rootScope.presentAccountInfo.organizationId);
        /**
         *  displayMode
         *  1 = allList , 2 = new , 3 = edit , 4 = filter_result  5 = all i can see List  6 = read detail
         */
        $scope.displayMode=1;
        $scope.changeDisplayMode = function(option){
            $scope.displayMode = option;
            if(option==1){
                $scope.searchName="";
                $scope.loadContactList();
            }
            if(option==5){
                $scope.searchName="";
                $scope.loadContactList();
            }
        };
        $scope.backToList = function(){
            if($scope.displayMode==6){
                $scope.changeDisplayMode(5);
            }else{
                $scope.changeDisplayMode(1);
            }
        };

        if($rootScope.toState.name == "orgContact"){
            $scope.title = "学生";
        }else{
            $scope.title = "校友";
        }


        $scope.allContact = [];
        $scope.readingAllContact = [];
        $scope.loadContactList = function(){
            OrgContactInfo.query({infoid:$rootScope.presentAccountInfo.id},function(result){
                // console.log(result);
                $scope.allContact = result;
                $scope.student = [];
                $scope.oldStudent = [];
                _.forEach(result,function(data){
                     if(data.categorys[0].id==12){
                         console.log(data);
                         $scope.student.push(data);
                     }else if(data.categorys[0].id==13){
                         $scope.oldStudent.push(data);
                     }
                });
                // if($scope.displayMode==1){
                //     $scope.initPageSort($scope.allContact);
                // }
                if($rootScope.toState.name == "orgContact"){
                    $scope.initPageSort($scope.student);
                }else{
                    $scope.initPageSort($scope.oldStudent);
                }


            });
            // OrgContactInfo.queryAll(function(result){
            //     //console.log(result);
            //     $scope.readingAllContact = result;
            //     if($scope.displayMode==5){
            //         $scope.initPageSort($scope.readingAllContact);
            //     }
            // });

            console.log($rootScope.toState.name);
        };
        $scope.loadContactList();
        $scope.returnAllContactLength = function(){
            // if($scope.displayMode==1){
            //     return $scope.allContact.length;
            // }else{
            //     return $scope.readingAllContact.length;
            // }
            if($rootScope.toState.name == "orgContact"){
                if($scope.student!=null){
                    return $scope.student.length;
                }
            }else{
                if($scope.oldStudent!=null){
                    return $scope.oldStudent.length;
                }
            }
        };

        //初始化
        $scope.getAllTagSet=function(){
            $scope.allTagSet=[];
            tagSetByOrg.query({id:$cookieStore.get("_currentOrganizationId")},function(result){
                $scope.allTagSet=result;
                // console.log("TAG SET:",result);
                $scope.tagList=[];
                angular.forEach(result,function (item) {
                    angular.forEach(item.tagList,function (x) {
                        $scope.tagList.push(x);
                    })
                })
            });
        };
        $scope.getAllTagSet();

        $scope.getAllCategory=function () {
            $scope.categoryList=[];
            Category.query({},function (result) {
                angular.forEach(result,function (item) {
                    if ($rootScope.currentOrganization.businessScope&item.businessScope){
                        $scope.categoryList.push(item);
                    }
                })
            })
        };
        $scope.getAllCategory();

        //编辑联系人
        $scope.initAddContactInfo = function(){
            $scope.addContactInfo={
                "baseInfo": {
                    "alias": null,
                    "baseContact": null,
                    "birthDate": null,
                    "blood": null,
                    "englishName": null,
                    "ethnic": null,
                    "gender": 0,
                    "height": 0,
                    "isNeighbor": false,
                    "name": null,
                    "party": null,
                    "photoUrl": null,
                    "qq": null,
                    "religion": null,
                    "timing": null,
                    "wechat": null,
                    "weight": 0,
                    "mobileNumberList":[],
                    "fixedNumberList":[],
                    "emailList":[],
                    "addresss":[]
                },
                "businessInfo": {
                    "businessConnection":null,
                    "friendshipToOrg":null,
                    "significanceToOrg":null
                },
                "censusInfo": {
                    "attachments": [],
                    "bankAccounts": []
                },
                "educationHistorys": [],
                "employeeInfo": {
                    "department": null,
                    "leaderName": null,
                    "level": null,
                    "position": null,
                    "professionsType": null,
                    "responsibility": null
                },
                "employmentStatus": null,
                "isEmployee": false,
                "orgCompanyName": null,
                "workHistorys": [
                ],
                "categorys":[],
                "origin":1,
                "organizationId":null
            };
        };
        $scope.initAddContactInfo();
        $scope.saveOrgContact = function(){
            $scope.addContactInfo.organizationId = $cookieStore.get("_currentOrganizationId");
            if($scope.displayMode==2){
                OrgContactInfo.save($scope.addContactInfo,function(result){
                    console.log($scope.addContactInfo);
                    $scope.changeDisplayMode(1);
                    $scope.loadContactList();
                    $scope.initAddContactInfo();
                },function(result){
                    console.log(result);
                })
            }else if($scope.displayMode==3){
                $scope.addContactInfo["origin"] = 0;
                OrgContactInfo.update($scope.addContactInfo,function(result){
                    $scope.changeDisplayMode(1);
                    $scope.loadContactList();
                    $scope.initAddContactInfo();
                },function(result){
                    console.log(result);
                })
            }

        };
        $scope.editContact = function(item){
            if(item.baseInfo.birthDate!=null){
                item.baseInfo.birthDate = new Date(item.baseInfo.birthDate);
            }
            if(item.workHistorys.length>0){
                _.forEach(item.workHistorys,function(data){
                    if(data.beginDate!=null){
                        data.beginDate = new Date(data.beginDate);
                    }
                    if(data.endDate!=null){
                        data.endDate = new Date(data.endDate);
                    }
                })
            }
            if(item.educationHistorys.length>0){
                _.forEach(item.educationHistorys,function(data){
                    if(data.entranceDate!=null){
                        data.entranceDate = new Date(data.entranceDate);
                    }
                    if(data.graduateDate!=null){
                        data.graduateDate = new Date(data.graduateDate);
                    }
                })
            }
            $scope.addContactInfo = item;
            $scope.changeDisplayMode(3);
        };
        $scope.readContact = function(item){
            if(item.baseInfo.birthDate!=null){
                item.baseInfo.birthDate = new Date(item.baseInfo.birthDate);
            }
            if(item.workHistorys.length>0){
                _.forEach(item.workHistorys,function(data){
                    if(data.beginDate!=null){
                        data.beginDate = new Date(data.beginDate);
                    }
                    if(data.endDate!=null){
                        data.endDate = new Date(data.endDate);
                    }
                })
            }
            if(item.educationHistorys.length>0){
                _.forEach(item.educationHistorys,function(data){
                    if(data.entranceDate!=null){
                        data.entranceDate = new Date(data.entranceDate);
                    }
                    if(data.graduateDate!=null){
                        data.graduateDate = new Date(data.graduateDate);
                    }
                })
            }
            $scope.addContactInfo = item;
            $scope.changeDisplayMode(6);
        };
        $scope.deleteContacts = function(){
            console.log($scope.selected);
            _.forEach($scope.selected,function(data){
                ContactInfo.delete({infoid:data},function(){
                    $scope.loadContactList();
                })
            })
        };
        $scope.selectCategory = function(){
            $scope.initAddContactInfo();
            ngDialog.open({
                templateUrl:"scripts/components/organizationBusiness/contact/selectCategory.html",
                overlay:false,
                scope:$scope,
                controller:["$scope",function(){
                    console.log($scope.addContactInfo);
                    $scope.choseThisCategory = function(item){
                        $scope.addContactInfo.categorys.push(item);
                        $scope.changeDisplayMode(2);
                        ngDialog.close();
                    };
                }]
            })
        };
        $scope.selectTag = function(){
            ngDialog.open({
                templateUrl:"scripts/components/organizationBusiness/contact/selectTag.html",
                overlay:false,
                scope:$scope,
                controller:["$scope",function(){
                    $scope.returnIsActive = function(option){
                        var find = false;
                        _.forEach($scope.addContactInfo.tags,function(data){
                            if(option==data.id){
                                find = true;
                            }
                        });
                        return find;
                    };
                    $scope.choseThisTag = function(option){
                        var find = false;
                        _.forEach($scope.addContactInfo.tags,function(data,index){
                            if(option.id==data.id){
                                $scope.addContactInfo.tags.splice(index,1);
                                find = true;
                            }
                        });
                        if(!find){
                            $scope.addContactInfo.tags.push(option);
                        }
                    };
                    $scope.confirm = function(){
                        ngDialog.close();
                    }
                }]
            })
        };

        $scope.selectOrgCompany = function(){
            ngDialog.open({
                templateUrl: "scripts/components/personalBusiness/company/selectCompany.html",
                overlay: false,
                closeByDocument: false,
                scope: $scope ,
                controller: ["$scope", function(){
                    OrgCompanyInfo.queryByEO({id:$rootScope.presentAccountInfo.id},function(result){
                        $scope.companyList1 = result;
                    });
                    $scope.choseCompany = function(id,name){
                        $scope.choseOrgCompany(id,name);
                        ngDialog.close();
                    }
                }]
            })
        };
        $scope.choseOrgCompany = function(id,name){
            $scope.addContactInfo.orgCompanyId = id;
            $scope.addContactInfo.orgCompanyName = name;
        };
        $scope.selectParentContact = function(){
            ngDialog.open({
                templateUrl: "scripts/components/organizationBusiness/contact/org_selectContact.html",
                overlay: false,
                closeByDocument: false,
                scope: $scope ,
                controller: ["$scope", function(){
                    OrgContactInfo.query({infoid:$rootScope.presentAccountInfo.id},function(result){
                        $scope.contactList1 = result;
                    });
                    $scope.choseContact = function(id,name){
                        $scope.choseParentContact(id,name);
                        ngDialog.close();
                    }
                }]
            })
        };
        $scope.choseParentContact = function(id,name){
            $scope.addContactInfo.employeeInfo.leaderId = id;
            $scope.addContactInfo.employeeInfo.leaderName = name;
        };
        $scope.addMobileNumberList = function(){
            $scope.mobileNumber = {
                name:"",
                value:""
            };
            $scope.addContactInfo.baseInfo.mobileNumberList.push($scope.mobileNumber);
        };
        $scope.deleteMobileNumberList = function(option){
            $scope.addContactInfo.baseInfo.mobileNumberList.splice(option,1);
        };
        $scope.addFixedNumberList = function(){
            $scope.fixedNumber = {
                name:"",
                value:""
            };
            $scope.addContactInfo.baseInfo.fixedNumberList.push($scope.fixedNumber);
        };
        $scope.deleteFixedNumberList = function(option){
            $scope.addContactInfo.baseInfo.fixedNumberList.splice(option,1);
        };
        $scope.addEmailList = function(){
            $scope.email = {
                name:"",
                value:""
            };
            $scope.addContactInfo.baseInfo.emailList.push($scope.email);
        };
        $scope.deleteEmailList = function(option){
            $scope.addContactInfo.baseInfo.emailList.splice(option,1);
        };
        $scope.addAddressList = function(){
            $scope.address = {
                "area": null,
                "city": null,
                "district": null,
                "house": null,
                "postcode": null,
                "province": null,
                "street": null
            };
            $scope.addContactInfo.baseInfo.addresss.push($scope.address);
        };
        $scope.deleteAddressList = function(option){
            $scope.addContactInfo.baseInfo.addresss.splice(option,1);
        };
        $scope.addWorkHistory = function(){
            $scope.workHistory = {
                "beginDate": null,
                "company": null,
                "department": null,
                "endDate": null,
                "level": null,
                "position": null,
                "professionsType": null,
                "reportPerson": null,
                "responsibility": null
            };
            $scope.addContactInfo.workHistorys.push($scope.workHistory);
        };
        $scope.deleteWorkHistory = function(option){
            $scope.addContactInfo.workHistorys.splice(option,1);
        };
        $scope.addEducationHistory = function(){
            $scope.educationHistory = {
                "diploma": null,
                "entranceDate": null,
                "faculty": null,
                "graduateDate": null,
                "institute": null,
                "major": null,
                "school": null,
                "schoolClass": null
            };
            $scope.addContactInfo.educationHistorys.push($scope.educationHistory);
        };
        $scope.deleteEducationHistory = function(){
            $scope.addContactInfo.educationHistorys.splice(option,1);
        };
        $scope.addFamilyInfo = function(){
            $scope.familyInfo = {
                "age": null,
                "educational": null,
                "evaluation": null,
                "gender": 0,
                "name": null,
                "relation": null,
                "remark": null,
                "workUnit": null
            };
            $scope.addContactInfo.familyInfos.push($scope.familyInfo);
        };
        $scope.deleteFamilyInfo = function(option){
            $scope.addContactInfo.familyInfos.splice(option,1);
        };
        //筛选
        $scope.initContactFilter = function(){
            $scope.contactFilter = {
                "address": {
                    "city": "",
                    "detailAddress": "",
                    "district": "",
                    "province": "",
                    "street": ""
                },
                "businessConnection": "",
                "friendshipToMe": "",
                "gender": "",
                "importanceToMe": "",
                "level": "",
                "professionalMajor": ""
            };
        };
        $scope.initContactFilter();
        $scope.filterContactList = function(){
            ngDialog.open({
                templateUrl: "scripts/components/personalBusiness/contact/org_filterContact.html",
                overlay: false,
                closeByDocument: false,
                scope: $scope ,
                controller: ["$scope", function(){
                    $scope.changeContactFilter = function(option,id){
                        var valueString = "";
                        switch(option){
                            case 1:
                                valueString = $scope.contactFilter.gender;
                                break;
                            case 2:
                                valueString = $scope.contactFilter.importanceToMe;
                                break;
                            case 3:
                                valueString = $scope.contactFilter.friendshipToMe;
                                break;
                            case 4:
                                valueString = $scope.contactFilter.businessConnection;
                                break;
                            case 5:
                                valueString = $scope.contactFilter.level;
                                break;
                        }
                        var valueList = valueString.split(",");
                        var find = false;
                        _.forEach(valueList,function(data,index){
                            if(id==data){
                                valueList.splice(index,1);
                                find = true;
                            }
                        });
                        if(!find){
                            if(valueString==""){
                                valueString = "" + id;
                            }else{
                                valueString = valueString + "," + id;
                            }
                        }else{
                            var str = "";
                            _.forEach(valueList,function(data){
                                str = str + data + ",";
                            });
                            str = str.substring(0,str.length-1);
                            valueString = str;
                        }
                        switch(option){
                            case 1:
                                $scope.contactFilter.gender = valueString;
                                break;
                            case 2:
                                $scope.contactFilter.importanceToMe = valueString;
                                break;
                            case 3:
                                $scope.contactFilter.friendshipToMe = valueString;
                                break;
                            case 4:
                                $scope.contactFilter.businessConnection = valueString;
                                break;
                            case 5:
                                $scope.contactFilter.level = valueString;
                                break;
                        }
                        // console.log(valueString);
                    };
                    $scope.returnContactFilter = function(option,id){
                        var find = false;
                        var valueString = "";
                        switch(option){
                            case 1:
                                valueString = $scope.contactFilter.gender;
                                break;
                            case 2:
                                valueString = $scope.contactFilter.importanceToMe;
                                break;
                            case 3:
                                valueString = $scope.contactFilter.friendshipToMe;
                                break;
                            case 4:
                                valueString = $scope.contactFilter.businessConnection;
                                break;
                            case 5:
                                valueString = $scope.contactFilter.level;
                                break;
                        }
                        var valueList = valueString.split(",");
                        _.forEach(valueList,function(data){
                            if(id == data){
                                find = true;
                                return find;
                            }
                        });
                        return find;
                    };
                    $scope.resetContactFilter = function(){
                        $scope.initContactFilter();
                    };
                    $scope.saveContactFilter = function(){
                        // console.log($scope.contactFilter);
                        ContactInfo.filter($scope.contactFilter,function(result){
                            $scope.changeDisplayMode(4);
                            $scope.allContact = result;
                            // console.log(result);
                            $scope.initPageSort(result);
                        });
                        ngDialog.close();
                    }
                }]
            })
        };

        //照片上传部分:
        // $scope.file={
        //     photo:undefined
        // };
        // $scope.submit = function() {
        //     if ($scope.file.photo!=undefined) {
        //         $scope.upload($scope.file.photo);
        //     }
        // };
        $scope.upload = function (file) {

            Upload.upload({
                url: '/api/uploadFile',
                data: {file: file}
            }).then(function (resp) {
                var location="http://www.diamondtiming.com:8686";
                // $scope.presentOrgContact.baseInfo.photoUrl=location+resp.data.path;
                $scope.addContactInfo.baseInfo.photoUrl=resp.data.path;
                OrgContactInfo.update({},$scope.addContactInfo,function (result) {
                    // console.log(result);
                    OrgContactInfo.queryOne({cid:result.id},function(result){
                        $scope.addContactInfo=result
                    })
                });
                // $scope.file.photo=undefined;
            }, function (resp) {
                // console.log(resp);
                // console.log('Error status: ' + resp.status);
            }, function (evt) {
                var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
                console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
            });
        };


        $scope.myImage1='';
        $scope.myCroppedImage='';

        var handleFileSelect=function(evt) {
            // console.log(evt);
            var file=evt.currentTarget.files[0];
            var reader = new FileReader();
            reader.onload = function (evt) {
                $scope.$apply(function($scope){
                    $scope.myImage1=evt.target.result;
                    // console.log($scope.myImage1);
                });
            };
            // $scope.myImage = evt.target.result;
            reader.readAsDataURL(file);
        };


        angular.element(document.querySelector('#fileInput1')).on('change',handleFileSelect);

        $scope.submit = function(){
            var $Blob = getBlobBydataURL($scope.myCroppedImage,"image/png");
            $scope.file = $Blob;
            $scope.upload($scope.file);

            $scope.myCroppedImage="";
            $scope.myImage1="";
        };

        //base64转image
        function getBlobBydataURL(dataURI,type){
            var binary = atob(dataURI.split(',')[1]);
            var array = [];
            for(var i = 0; i < binary.length; i++) {
                array.push(binary.charCodeAt(i));
            }
            return new Blob([new Uint8Array(array)], {type:type });
        }













        //分页控制实现
        $scope.pageSize=10;
        $scope.items = [];
        $scope.initPageSort=function(item){
            $scope.data = item;
            $scope.pages = Math.ceil($scope.data.length / $scope.pageSize); //分页数
            $scope.newPages = $scope.pages > 5 ? 5 : $scope.pages;
            $scope.pageList = [];
            $scope.selPage = 1;
            //设置表格数据源(分页)
            $scope.setData = function () {
                $scope.items = $scope.data.slice(($scope.pageSize * ($scope.selPage - 1)), ($scope.selPage * $scope.pageSize));//通过当前页数筛选出表格当前显示数据
            };
            $scope.items = $scope.data.slice(0, $scope.pageSize);
            //分页要repeat的数组
            for (var i = 0; i < $scope.newPages; i++) {
                $scope.pageList.push(i + 1);
            }
            //打印当前选中页索引
            $scope.selectPage = function (page) {
                //不能小于1大于最大
                if (page < 1 || page > $scope.pages) return;
                //最多显示分页数5
                if (page > 2) {
                    //因为只显示5个页数，大于2页开始分页转换
                    var newpageList = [];
                    for (var i = (page - 3); i < ((page + 2) > $scope.pages ? $scope.pages : (page + 2)); i++) {
                        newpageList.push(i + 1);
                    }
                    $scope.pageList = newpageList;
                }
                $scope.selPage = page;
                $scope.setData();
                $scope.isActivePage(page);
                //console.log("选择的页：" + page);
            }
        };
        //设置当前选中页样式
        $scope.isActivePage = function (page) {
            return $scope.selPage == page;
        };
        //上一页
        $scope.Previous = function () {
            $scope.selectPage($scope.selPage - 1);
        };
        //下一页
        $scope.Next = function () {
            $scope.selectPage($scope.selPage + 1);
        };
        $scope.$watch(function(){
            return $scope.searchName;
        },function(){
            if($scope.searchName!=null && $scope.searchName!=""){
                var newObj=[];
                if($scope.displayMode==1){
                    _.forEach($scope.allContact,function(data){
                        if(data.baseInfo.name.indexOf($scope.searchName)>=0){
                            newObj.push(data);
                        }
                    });
                }else{
                    _.forEach($scope.readingAllContact,function(data){
                        if(data.baseInfo.name.indexOf($scope.searchName)>=0){
                            newObj.push(data);
                        }
                    });
                }
                $scope.initPageSort(newObj);
            }else{
                if($scope.displayMode==1){
                    $scope.initPageSort($scope.allContact);
                }else{
                    $scope.initPageSort($scope.readingAllContact);
                }
            }
        });



        //checkbox实现相关
        //创建变量用来保存选中结果
        $scope.selected = [];
        var updateSelected = function (action, id) {
            if (action == 'add' && $scope.selected.indexOf(id) == -1) $scope.selected.push(id);
            if (action == 'remove' && $scope.selected.indexOf(id) != -1) $scope.selected.splice($scope.selected.indexOf(id), 1);
        };
        //更新某一列数据的选择
        $scope.updateSelection = function ($event, id) {
            var checkbox = $event.target;
            var action = (checkbox.checked ? 'add' : 'remove');
            updateSelected(action, id);
        };
        //全选操作
        $scope.selectAll = function ($event) {
            var checkbox = $event.target;
            var action = (checkbox.checked ? 'add' : 'remove');
            for (var i = 0; i < $scope.items.length; i++) {
                var toDo = $scope.items[i];
                updateSelected(action, toDo.id);
            }
        };
        $scope.isSelected = function (id) {
            return $scope.selected.indexOf(id) >= 0;
        };
        $scope.isSelectedAll = function () {
            return $scope.selected.length === $scope.items.length;
        };

        $scope.returnFriendshipName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.friendshipToMeList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };

        $scope.returnProfessionsTypeName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.professonsTypeList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };
        $scope.returnLevelName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.levelList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };

        $scope.returnImportanceName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.importanceToMeList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };

        $scope.returnBusinessConnectionName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.businessConnectionList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };
        $scope.returnGenderName = function(option){
            var name = "";
            if(option!=null){
                _.forEach($scope.genderList,function(data){
                    if(data.value == option){
                        name = data.name;
                    }
                })
            }
            return name;
        };
        $scope.genderList = [
            {
                name:"男",
                value:1
            },
            {
                name:"女",
                value:0
            }
        ];
        $scope.personalConnectionList = [
            {
                name:"同事",
                value:"0"
            },
            {
                name:"家庭",
                value:"1"
            },
            {
                name:"亲戚",
                value:"2"
            },
            {
                name:"同学",
                value:"3"
            },
            {
                name:"校友",
                value:"4"
            },
            {
                name:"战友",
                value:"5"
            },
            {
                name:"老乡",
                value:"6"
            },
            {
                name:"师生",
                value:"7"
            },
            {
                name:"活动伙伴",
                value:"8"
            },
            {
                name:"特殊",
                value:"9"
            },
            {
                name:"其他",
                value:"10"
            }
        ];
        $scope.businessConnectionList = [
            {
                name:"客户",
                value:"0"
            },
            {
                name:"合作伙伴",
                value:"1"
            },
            {
                name:"竞争对手",
                value:"2"
            },
            {
                name:"争取对象",
                value:"3"
            },
            {
                name:"供应商",
                value:"4"
            },
            {
                name:"政府管理",
                value:"5"
            },
            {
                name:"关注对象",
                value:"6"
            },
            {
                name:"服务对象",
                value:"7"
            },
            {
                name:"人才",
                value:"8"
            },
            {
                name:"学生",
                value:"9"
            },
            {
                name:"其他",
                value:"10"
            }
        ];
        $scope.friendshipToMeList = [
            {
                name:"讨厌",
                value:"0"
            },
            {
                name:"烦",
                value:"1"
            },
            {
                name:"认识",
                value:"2"
            },
            {
                name:"接受",
                value:"3"
            },
            {
                name:"喜欢",
                value:"4"
            }
        ];
        $scope.importanceToMeList = [
            {
                name:"不需要",
                value:"0"
            },
            {
                name:"需要",
                value:"1"
            },
            {
                name:"重要",
                value:"2"
            },
            {
                name:"很重要",
                value:"3"
            },
            {
                name:"极其重要",
                value:"4"
            }
        ];
        $scope.professonsTypeList = [
            {
                name:"销售",
                value:"0"
            },
            {
                name:"管理",
                value:"1"
            },
            {
                name:"技术",
                value:"2"
            },
            {
                name:"市场",
                value:"3"
            },
            {
                name:"财务",
                value:"4"
            },
            {
                name:"运营",
                value:"5"
            },
            {
                name:"人力资源",
                value:"6"
            },
            {
                name:"信息化",
                value:"7"
            },
            {
                name:"生产",
                value:"8"
            },
            {
                name:"通讯",
                value:"9"
            },
            {
                name:"交通",
                value:"10"
            },
            {
                name:"教育",
                value:"11"
            },
            {
                name:"法律",
                value:"12"
            },
            {
                name:"医疗",
                value:"13"
            },
            {
                name:"新闻",
                value:"14"
            },
            {
                name:"文化艺术",
                value:"15"
            },
            {
                name:"金融",
                value:"16"
            },
            {
                name:"保险",
                value:"17"
            },
            {
                name:"宗教",
                value:"18"
            },
            {
                name:"军人",
                value:"19"
            },
            {
                name:"体育",
                value:"20"
            }
        ];
        $scope.constellationList = [
            {
                name:"白羊座",
                value:"0"
            },
            {
                name:"金牛座",
                value:"1"
            },
            {
                name:"双子座",
                value:"2"
            },
            {
                name:"巨蟹座",
                value:"3"
            },
            {
                name:"狮子座",
                value:"4"
            },
            {
                name:"处女座",
                value:"5"
            },
            {
                name:"天秤座",
                value:"6"
            },
            {
                name:"天蝎座",
                value:"7"
            },
            {
                name:"射手座",
                value:"8"
            },
            {
                name:"摩羯座",
                value:"9"
            },
            {
                name:"水瓶座",
                value:"10"
            },
            {
                name:"双鱼座",
                value:"11"
            }
        ];
        $scope.bloodList = [
            {
                name:"A型",
                value:"0"
            },
            {
                name:"B型",
                value:"1"
            },
            {
                name:"AB型",
                value:"2"
            },
            {
                name:"O型",
                value:"3"
            },
            {
                name:"稀有血型",
                value:"4"
            }
        ];
        $scope.levelList = [
            {
                name:"入门级",
                value:"0"
            },
            {
                name:"初级",
                value:"1"
            },
            {
                name:"中级",
                value:"2"
            },
            {
                name:"高级",
                value:"3"
            },
            {
                name:"最高级",
                value:"4"
            }
        ];

    });